

package org.smallbun.fast.manage.activity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.smallbun.fast.manage.activity.dao.ActivityMapper;
import org.smallbun.fast.manage.activity.dao.SignUpMapper;
import org.smallbun.fast.manage.activity.entity.ActivityEntity;
import org.smallbun.fast.manage.activity.entity.SignUpEntity;
import org.smallbun.fast.manage.activity.service.ActivityService;
import org.smallbun.fast.manage.activity.service.SignUpService;
import org.smallbun.framework.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;


/**
 * @author lovec
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class, readOnly = true)
public class SignUpServiceImpl extends BaseServiceImpl<SignUpMapper, SignUpEntity> implements SignUpService {

    private final SignUpMapper signUpMapper;

    public SignUpServiceImpl(SignUpMapper signUpMapper) {
        this.signUpMapper = signUpMapper;
    }

    @Override
    public Integer findSignUpByOpenIdAndActivityId(String openId, Long activityId) {
        QueryWrapper<SignUpEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("open_id",openId).eq("activity_id",activityId);
        Integer count = signUpMapper.selectCount(queryWrapper);
        return count;
    }
}
